package it.isa.demo.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

/**
 * @author Corgile
 * @date 2022-02-27
 * 配置双数据源
 */
@Configuration
public class JdbcTemplateConfig {
	@Bean
	JdbcTemplate jdbcTemplateOne(@Qualifier(value = "primaryDataSource") DataSource ds) {
		return new JdbcTemplate(ds);
	}

	@Bean
	JdbcTemplate jdbcTemplateTwo(@Qualifier(value = "secondaryDataSource") DataSource ds) {
		return new JdbcTemplate(ds);
	}
}
